<#include "constants.ftl" />
<#if PageResult.list??>
    <div>
        <#if  (PageResult.list?size > 0)>
            <div align="center">
                <nav aria-label="Page navigation">
                    <ul class="pagination pagination-lg  justify-content-center">
                        <#assign totalPages = PageResult.totalPages>
                        <#assign totalElements = PageResult.totalElements>
                        <#assign paNo = PageResult.pageNo>
                        <#assign first = PageResult.first>
                        <#assign last = PageResult.last>
                        <#--上一页-->
                        <#if first>
                            <li class="page-item">
                                <a class="page-link" href="#">上一页</a>
                            </li>
                        <#else>
                            <li class="page-item">
                                <a class="page-link" href="javascript:doIt({'pageNo':'${paNo-1}', 'pageSize': '${DEFAULT_PAGE_SIZE}'})">上一页</a>
                            </li>
                        </#if>

                        <#--小于等于10页全部显示-->
                        <#if totalPages <= 10>
                            <#list 1..totalPages as pageIndex>
                                <#if paNo == pageIndex>
                                    <li class="page-item active">
                                        <a class="page-link" href="javascript:doIt({'pageNo':'${pageIndex}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${pageIndex}</a>
                                    </li>
                                <#else>
                                    <li class="page-item active">
                                        <a class="page-link" href="javascript:doIt({'pageNo':'${pageIndex}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${pageIndex}</a>
                                    </li>
                                </#if>
                            </#list>
                        </#if>

                        <#--大于10页：显示前5页，最后3页，中间用 ...-->
                        <#if totalPages gt 10>
                        <#--显示前5页-->
                            <#list 1..5 as pageIndex>
                                <#if paNo == pageIndex>
                                    <li class="page-item active">
                                        <a class="page-link" href="javascript:doIt({'pageNo':'${pageIndex}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${pageIndex}</a>
                                    </li>
                                <#else>
                                    <li class="page-item">
                                        <a class="page-link" href="javascript:doIt({'pageNo':'${pageIndex}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${pageIndex}</a>
                                    </li>
                                </#if>
                            </#list>

                        <#--中间部分的显示 ...  paNo: currentPage, 区间逻辑的判断-->
                            <#if paNo == 6 >
                                <li class="page-item active">
                                    <a class="page-link" href="javascript:doIt({'pageNo':'${paNo}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${paNo}</a>
                                </li>
                                <li class="page-item">
                                    <a class="page-link" href="#">...</a>
                                </li>
                            <#elseif paNo == totalPages-3>
                                <li class="page-item">
                                    <a class="page-link" href="#">...</a>
                                </li>
                                <li class="page-item active">
                                    <a class="page-link" href="javascript:doIt({'pageNo':'${paNo}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${paNo}</a>
                                </li>
                            <#elseif paNo gt 6 && paNo lt totalPages-3>
                                <li class="page-item">
                                    <a class="page-link" href="#">...</a>
                                </li>
                                <li class="page-item active">
                                    <a class="page-link" href="javascript:doIt({'pageNo':'${paNo}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${paNo}</a>
                                </li>
                                <li class="page-item">
                                    <a class="page-link" href="#">...</a>
                                </li>
                            <#else>
                                <li class="page-item">
                                    <a class="page-link" href="#">...</a>
                                </li>
                            </#if>

                        <#--显示最后3页-->
                            <#list totalPages-2..totalPages as pageIndex>
                                <#if paNo == pageIndex>
                                    <li class="page-item active">
                                        <a class="page-link" href="javascript:doIt({'pageNo':'${pageIndex}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${pageIndex}</a>
                                    </li>
                                <#else>
                                    <li class="page-item">
                                        <a class="page-link" href="javascript:doIt({'pageNo':'${pageIndex}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">${pageIndex}</a>
                                    </li>
                                </#if>
                            </#list>
                        </#if>

                        <#--下一页-->
                        <#if last>
                            <li class="page-item">
                                <a class="page-link" href="#">下一页</a>
                            </li>
                        <#else>
                            <li class="page-item">
                                <a class="page-link" href="javascript:doIt({'pageNo':'${paNo + 1}', 'pageSize':'${DEFAULT_PAGE_SIZE}'})">下一页</a>
                            </li>
                        </#if>
                    </ul>
                    <div class="center">共<span class="STYLE2">${totalPages}</span>页， 共<span class="STYLE2">${totalElements}</span>条记录，当前第<span class="STYLE2">${paNo}</span>页.</div>
                </nav>
            </div>
            <table width="500" height="200" border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">序号</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">区域名称</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">区域简称</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">简称拼音</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">区域组合名称</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">区域级别</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">邮政编码</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">区号</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">行政区码</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">父级行政区码</span></td>
                    <td  height="65" align="center" valign="middle"><span class="STYLE14">经纬度</span></td>
                </tr>
                <#list PageResult.list as area>
                    <tr>
                        <td width="320" height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area_index + 1 + (PageResult.pageNo - 1)*PageResult.pageSize}</span></td>
                        <td width="320" height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.name}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.shortName}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.pinyin}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.mergeName}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.level}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.zipCode?string('000000')}</td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.cityCode}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.code}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">${area.parentCode}</span></td>
                        <td  height="65" align="center" valign="middle"><span
                                    class="STYLE15">(<#if area.longitude &gt; 0>E</#if><#if area.longitude &lt; 0>W</#if>${area.longitude},
                             <#if area.latitude &gt; 0>N</#if><#if area.latitude &lt; 0>S</#if>${area.latitude})</span></td>
                    </tr>
                </#list>
            </table>

        <#else>
            <div align="center"><span class="STYLE2">无结果 </span></div>
        </#if>
    </div>
</#if>